1 using UnityEngine;
2 using
System.Collections;
3
4 public
class CameraFixAspectRatio : MonoBehaviour
5 {
6
7     
// Use this for initialization
8     
void Start()
9     {
10         Camera camera = GetComponent<Camera>();
11         
float aspect = Mathf.Round(camera.aspect * 100f) / 100f;
12
13         
//this is to be altered different Windows Phone 8 aspect ratios
14         
//there should be a better way of doing this
15         
if (aspect == 0.6f) //WXGA or WVGA
16             camera.orthographicSize =
5;
17         
else if (aspect == 0.56f) //720p
18         {
19             camera.orthographicSize =
4.6f;
20         }
21
22
23     }
24 }



Trò chơi Angry Birds trong UNITY Engine 31.669 lượt xem

Gõ tìm kiếm nhanh...